home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Sound Editor / Source / SESettingsExtension.cpp < prev    next >
Encoding:
Text File  |  1995-12-11  |  3.2 KB  |  121 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SESettingsExtension.cpp
  3.  
  4.     Contains:    SoundEditor Settings Extension class implementation
  5.  
  6.     Written by:    Steve Smith
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11.  
  12. // -- Compiler/Preprocessor Switches --
  13.  
  14. #ifndef _COMPILERDEFS_
  15. #include "CompDefs.h"
  16. #endif
  17.  
  18. // -- OpenDoc Utilities --
  19.  
  20. #ifndef _EXCEPT_
  21. // Exceptions define several important macros (eg. CHECKENV)
  22. // which are used in the SOM method dispatch glue. If Except.h
  23. // is not included early enough, exceptions may not be thrown
  24. // correctly when returning from a SOM method with the "ev" parameter set.
  25. #include <Except.h>
  26. #endif
  27.  
  28. // -- SoundEditor Includes --
  29.  
  30. #ifndef _SESETTINGSEXTENSION_
  31. #include "SESettingsExtension.h"
  32. #endif
  33.  
  34. #ifndef _SOUNDEDITOR_
  35. #include "SoundEditor.h"
  36. #endif
  37.  
  38. #ifndef SOM_SampleCode_som_SoundEditor_xh
  39. #include "som_SoundEditor.xh"
  40. #endif
  41.  
  42. // -- OpenDoc Includes --
  43.  
  44. #ifndef _ODTYPES_
  45. #include <ODTypes.h>
  46. #endif
  47.  
  48. #ifndef SOM_ODFacet_xh
  49. #include <Facet.xh>
  50. #endif
  51.  
  52.  
  53. #pragma segment SESettingsExtension
  54.  
  55. //==============================================================================
  56. // SESettingsExtension
  57. //==============================================================================
  58.  
  59. //------------------------------------------------------------------------------
  60. // Method:        Constructor
  61. //
  62. // Description:    
  63. //------------------------------------------------------------------------------
  64.  
  65. SESettingsExtension::SESettingsExtension()
  66. {
  67.     SOM_Trace("SESettingsExtension","SESettingsExtension");
  68.     
  69.     fOwner = kODNULL;
  70. }
  71.  
  72. //------------------------------------------------------------------------------
  73. // Method:        Destructor
  74. //
  75. // Description:    
  76. //------------------------------------------------------------------------------
  77.  
  78. SESettingsExtension::~SESettingsExtension()
  79. {
  80.     SOM_Trace("SESettingsExtension","somUninit");
  81. }
  82.  
  83. //------------------------------------------------------------------------------
  84. // Method:        InitSettingsExtension
  85. //
  86. // Description:    
  87. //------------------------------------------------------------------------------
  88.  
  89. void SESettingsExtension::InitSettingsExtension( Environment*    ev,
  90.                                                  ODPart*        owner )
  91. {
  92.     SOM_Trace("SESettingsExtension","InitSettingsExtension");
  93.     
  94.     // Here we get the real part, which means that we get the actual ODPart
  95.     // that the part wrapper points to.  We know that this will be an
  96.     // object of the SampleCode_som_SoundEditor class, so we cast it thusly.
  97.     // From this object, we use our GetImplementation function, which
  98.     // returns a pointer to our wrapped C++ object so that we can call it
  99.     // directly.  This is safe because the extension and the part will be in
  100.     // the same address space and machine.
  101.     fOwner = ((SampleCode_som_SoundEditor*) owner->GetRealPart(ev))
  102.                     ->GetImplementation(ev);
  103.     
  104.     owner->ReleaseRealPart(ev);
  105. }
  106.  
  107. //------------------------------------------------------------------------------
  108. // Method:        ShowSettings
  109. //
  110. // Description:    
  111. //------------------------------------------------------------------------------
  112.  
  113. void SESettingsExtension::ShowSettings( Environment*    ev,
  114.                                         ODFacet*        facet )
  115. {
  116.     SOM_Trace("SESettingsExtension","ShowSettings");
  117.  
  118.     fOwner->ShowSettingsDialog(ev, facet->GetFrame(ev));
  119. }
  120.  
  121.